// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-12

package kind

// TicketRecord
// 购票状态.
type TicketRecord int

const (
	_ TicketRecord = iota

	TicketRecordWaiting   // 等待开始
	TicketRecordStarted   // 开始
	TicketRecordStopped   // 停止
	TicketRecordCompleted // 完成
)

var (
	ticketRecordTexts = map[TicketRecord]string{
		TicketRecordWaiting:   "未开始",
		TicketRecordStarted:   "已开始",
		TicketRecordStopped:   "已结束",
		TicketRecordCompleted: "已完成",
	}
	ticketRecordUndefined = ""

	ticketRecordFlags = map[TicketRecord]string{
		TicketRecordWaiting:   "waiting",
		TicketRecordStarted:   "started",
		TicketRecordStopped:   "stopped",
		TicketRecordCompleted: "completed",
	}
	ticketRecordUnknownFlag = ""
)

func (o TicketRecord) Flag() string {
	if str, ok := ticketRecordFlags[o]; ok {
		return str
	}
	return ticketRecordUnknownFlag
}

func (o TicketRecord) IsWaiting() bool   { return o == TicketRecordWaiting }
func (o TicketRecord) IsStarted() bool   { return o == TicketRecordStarted }
func (o TicketRecord) IsStopped() bool   { return o == TicketRecordStopped }
func (o TicketRecord) IsCompleted() bool { return o == TicketRecordCompleted }

func (o TicketRecord) Text() string {
	if str, ok := ticketRecordTexts[o]; ok {
		return str
	}
	return ticketRecordUndefined
}
